﻿using SCRUM.Core.BusinessObjects;
using System.Collections.Generic;

namespace SCRUM.Core.DAO
{
    /// <summary>
    /// Data access object for the team
    /// </summary>
    public static class DAOTeam
    {
        /// <summary>
        /// Gets all teams.
        /// </summary>
        /// <returns>List of all teams.</returns>
        public static List<Team> GetAllTeams()
        {
            return DataProviders.ProviderFactory.Provider.GetAllTeams();
        }

        /// <summary>
        /// Gets all teams.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <returns>List of teams associated to the project.</returns>
        public static IList<Team> GetAllTeams(int projectID)
        {
            return DataProviders.ProviderFactory.Provider.GetAllTeams(projectID);
        }

        /// <summary>
        /// Gets the team.
        /// </summary>
        /// <param name="id">The id of the team.</param>
        /// <returns>Team with specified id.</returns>
        public static Team GetTeam(int id)
        {
            return DataProviders.ProviderFactory.Provider.GetTeam(id);
        }

        /// <summary>
        /// Gets the team.
        /// </summary>
        /// <param name="user">The user of the team.</param>
        /// <returns>Team for specified user.</returns>
        public static IList<Team> GetTeamForUser(User user)
        {
            return DataProviders.ProviderFactory.Provider.GetTeamForUser(user);
        }

        /// <summary>
        /// Creates new team in specified project with specified team name
        /// </summary>
        /// <param name="teamName">Name of new team.</param>
        /// <param name="projectID">new team's project ID.</param>
        public static Team CreateTeam(string teamName, int projectID)
        {
            return DataProviders.ProviderFactory.Provider.CreateTeam(teamName, projectID);
        }

        /// <summary>
        /// Deletes the team with specified ID.
        /// </summary>
        /// <param name="teamID">The team ID.</param>
        public static void DeleteTeam(int teamID)
        {
            DataProviders.ProviderFactory.Provider.DeleteTeam(teamID);
        }
    }
}
